﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainManager.master" AutoEventWireup="true" CodeFile="PageNguoiDung.aspx.cs" Inherits="PageNguoiDung" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
                        <div class="row-fluid">
                <div class="span12" id="divMsg" runat="server" visible="false">
                    <div class="alert" id="divAlert" runat="server"></div>
                </div>
            </div>
            <div class="row-fluid">

                <div class="span12">
                    <h3>Quản lý người dùng</h3>
                    <div class="well">
                        
                        <a id="btnDeleteAll" runat="server" onserverclick="btnDeleteAll_Click" class="btn btn-danger multidelete" >Xóa dòng được chọn</a>
                        <a href="#myModal" role="button" class="btn btn-primary" data-toggle="modal">Thêm mới</a>
                        <a href="#" class="btn btn-warning" id="btnRefresh" runat="server" onserverclick="btnRefresh_ServerClick"><i class="icon-refresh"></i></a>
                        <a class="btn disabled" runat="server" id="lblCount">Hiện đang có  mục trong CSDL.</a>
                    </div>

                    <asp:GridView ID="gvData" runat="server" GridLines="None"
                        AutoGenerateColumns="false" CssClass="table table-striped table-bordered"
                        DataKeyNames="ID" ShowFooter="false" AllowPaging="true">
                        <Columns>
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="">
                                <HeaderTemplate>
                                    <input type="checkbox" id="check_all" />
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkSelect" runat="server" ClientIDMode="Static" />

                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" Width="10" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="ID"
                                HeaderText="#" HeaderStyle-Width="30" ReadOnly="true" />


                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Tên">
                                <ItemTemplate>
                                    <%# Eval("TenDangNhap") %>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtTenNguoiDung" runat="server" Text='<%#Eval("TenDangNhap") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <HeaderStyle HorizontalAlign="Left"/>

                                
                            </asp:TemplateField>

                              
                            <asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderText="Phân quyên">
                                <ItemTemplate>
                                    <%# Eval("PhanQuyen") %>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtPhanQuyen" runat="server" Text='<%#Eval("PhanQuyen") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <HeaderStyle HorizontalAlign="Left"/>

                                
                            </asp:TemplateField>
                          
                            <asp:TemplateField HeaderText="Xóa">
                                <HeaderStyle Width="20" HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" CommandName="Delete" ToolTip="Xóa"
                                        Text="<i class='icon-trash'></i>" OnClientClick="return confirm('Bạn có chắc chắn xóa dòng này?')" />
                                </ItemTemplate>
                            </asp:TemplateField>
                           
                            <asp:CommandField HeaderText="Sửa" HeaderStyle-Width="10" ShowEditButton="True" EditText="<i class='icon-edit'></i>" UpdateText="<i class='icon-ok'></i>" CancelText="<i class='icon-remove'></i>" CausesValidation="false" ControlStyle-Width="10" />
                        </Columns>
                    </asp:GridView>

                </div>
            </div>


            <!-- Modal -->
            <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Thêm mới Người dùng</h3>
                </div>
                <div class="modal-body">
                    <label>Tên Người dùng</label>
                    <asp:TextBox ID="txtTenNguoiDung" runat="server" CssClass="input input-xlarge"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="reTxt" runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="txtTenNguoiDung">

                    </asp:RequiredFieldValidator>


                     <label>Mât khẩu</label>
                    <asp:TextBox ID="txtMatKhau" runat="server" CssClass="input input-xlarge"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="txtMatKhau">

                    </asp:RequiredFieldValidator>


                     <label>Quyền</label>
                    <asp:TextBox ID="txtPhanQuyen" runat="server" CssClass="input input-xlarge"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="txtPhanQuyen">

                    </asp:RequiredFieldValidator>
                </div>
                <div class="modal-footer">
                    <button class="btn" data-dismiss="modal" aria-hidden="true">Hủy</button>
                    <asp:Button CssClass="btn btn-primary" id="btnSaveNew" runat="server" OnClick="btnSaveNew_ServerClick" Text="Lưu" />
                </div>
            </div>

        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="gvData" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>

